using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace OrganizedConfusion
{
    public abstract class GameState
    {
        StateManager state_Manager;
        InputManager input_Manager;
        ContentManager content_Manager;
        bool isExiting;


        public ContentManager Contentmanager
        {
            get { return content_Manager; }
            internal set { content_Manager = value; }
        }
        public InputManager Inputmanager
        {
            get { return input_Manager; }
            internal set { input_Manager = value; }
        }
        public StateManager Statemanager
        {
            get { return state_Manager; }
            internal set { state_Manager = value; }
        }
        public bool IsExiting
        {
            get { return isExiting; }
            protected internal set { isExiting = value; }
        }


        public GameState()
        {
            Inputmanager = new InputManager();
        }

        public virtual void LoadContent()
        {
            if (Contentmanager == null)
                Contentmanager = new ContentManager(Statemanager.Game.Services, "Content");
        } 

        public virtual void Input() { }
        public virtual void Update(GameTime gameTime)
        {
            if (isExiting)
                state_Manager.RemoveState(this);
        }

        /// <summary>
        /// Does the Draw calls
        /// </summary>
        public virtual void Render(GameTime gameTime) { }
        public virtual void UnloadContent() // exit
        {
            content_Manager.Unload();
        }
        public void ExitScreen()
        {
            isExiting = false;
        }
    }
}
